home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_1.3 / Read-Me1.3 / Printer1.3 / Driver.Examples / src / epsonX / density.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-01  |  1.1 KB  |  40 lines

  1. /*
  2.     Density module for EpsonX driver.
  3.     David Berezowski - October/87.
  4. */
  5.  
  6. #include <exec/types.h>
  7. #include "../printer/printer.h"
  8. #include "../printer/prtbase.h"
  9.  
  10. SetDensity(density_code)
  11. ULONG density_code;
  12. {
  13.     extern struct PrinterData *PD;
  14.     extern struct PrinterExtendedData *PED;
  15.  
  16.     /* SPECIAL_DENSITY     0    1    2    3    4    5    6    7 */
  17.     static int XDPI[8] = {120, 120, 120, 240, 120, 240, 240, 240};
  18.     static int YDPI[8] = {72, 72, 144, 72, 216, 144, 216, 216};
  19.     static char codes[8] = {'L', 'L', 'L', 'Z', 'L', 'Z', 'Z', 'Z'};
  20.  
  21.     PED->ped_MaxColumns = 
  22.         PD->pd_Preferences.PaperSize == W_TRACTOR ? 136 : 80;
  23.     density_code /= SPECIAL_DENSITY1;
  24.     /* default is 80 chars (8.0 in.), W_TRACTOR is 136 chars (13.6 in.) */
  25.     PED->ped_MaxXDots =
  26.         (XDPI[density_code] * PED->ped_MaxColumns) / 10;
  27.     PED->ped_XDotsInch = XDPI[density_code];
  28.     PED->ped_YDotsInch = YDPI[density_code];
  29.     if ((PED->ped_YDotsInch = YDPI[density_code]) == 216) {
  30.         PED->ped_NumRows = 24;
  31.     }
  32.     else if (PED->ped_YDotsInch == 144) {
  33.         PED->ped_NumRows = 16;
  34.     }
  35.     else {
  36.         PED->ped_NumRows = 8;
  37.     }
  38.     return(codes[density_code]);
  39. }
  40.